<?php
// +----------------------------------------------------------------------
// | snake
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 http://baiyf.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: NickBai <1902822973@qq.com>
// +----------------------------------------------------------------------
namespace app\admin\model;

use think\Model;
use think\Db;

class StatisticalModel extends Model
{
    // 确定链接表名
    protected $table = 'wb_message';

    /**
     * 统计查询Statistical
     * @param $where
     * @param $offset
     * @param $limit
     */
    public function getStatisticalByWhere($where, $offset, $limit)
    {
        return $res= $this->table('wb_buser')->alias('b')
            ->join('wb_message m','b.id=m.uid')
            ->field('*')
            ->where($where)
            ->limit($offset, $limit)->order('b.id asc')->select();
    }

    /**
     * 根据搜索条件获取所有的用户数量
     * @param $where
     */
    public function getAllStatistical($where)
    {
        return $this->where($where)->count();
    }
}